/*
 *    Copyright (c) 2018-2025, bfcloud All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: bfcloud
 */

import request from '@/router/axios'

export function fetchList(query) {
  return request({
    url: '/jiangjin/jiangjinjjjgwh/page',
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: '/jiangjin/jiangjinjjjgwh',
    method: 'post',
    data: obj
  })
}

export function getJjList(id) {
  return request({
    url: '/jiangjin/jiangjinjjjgwh/' + id,
    method: 'get'
  })
}

export function delObj(id) {
  return request({
    url: '/jiangjin/jiangjinjjjgwh/' + id,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: '/jiangjin/jiangjinjjjgwh',
    method: 'put',
    data: obj
  })
}

//根据部门id查询表list
export function getJjListByDeptId(fzId) {
  return request({
    url: '/jiangjin/jiangjinjjjgwh/getByDeptId/' + fzId,
    method: 'get'
  })
}
//根据部门id查询表list
export function getJjListByDeptIdFzMx(deptId) {
  return request({
    url: '/jiangjin/jiangjinjjjgwh/getByDeptIdfzMx/' + deptId,
    method: 'get'
  })
}
//查询表list
export function getJjjgwhList() {
  return request({
    url: '/jiangjin/jiangjinjjjgwh/JjjgwhList',
    method: 'get'
  })
}

export function getJjListRecordByDeptId(deptid) {
  return request({
    url: '/jiangjin/jiangjinjjjgwh/getRecordByDeptId/' + deptid,
    method: 'get'
  })
}

/**
 * 通过机构奖金管理员ID查询
 * @param {*} deptid
 * @returns
 */
export function getByHJgGlUserId() {
  return request({
    url: '/jiangjin/jiangjinjjjgwh/getByHJgGlUserId',
    method: 'get'
  })
}

/**
 * 根据分组id读取成员list
 * @param {*} id
 * @returns
 */
export function getFzList(id) {
  return request({
    url: '/jiangjin/jiangjinjjjgwh/getFzList/' + id,
    method: 'get',
  })
}

/**
 * 根据分组id保存成员list
 * @param {*} obj
 * @param {*} id
 * @returns
 */
export function insertJgmxbList(obj, id) {
  return request({
    url: '/jiangjin/jiangjinjjjgwh/insertJgmxbList/' + id,
    method: 'post',
    data: obj
  })
}

/**
 * 根据分组id去除成员list
 * @param {*} id
 * @returns
 */
export function updateJgmxbList(obj) {
  return request({
    url: '/jiangjin/jiangjinjjjgwh/updateJgmxbList',
    method: 'post',
    data: obj
  })
}

export function insertJgmxbListNew(obj, id) {
  return request({
    url: '/jiangjin/jiangjinjjjgwh/insertJgmxbListNew/' + id,
    method: 'post',
    data: obj
  })
}